<?php
/**
 * Created by PhpStorm.
 * User: Inhere
 * Date: 2015/1/29
 * Use : ...
 * File: UserServiceProvider.php
 */

namespace ulue\base\providers;


use ulue\core\ioc\Container;
use ulue\core\ioc\InterfaceServiceProvider;
use  ulue\parts\User;

class UserServiceProvider implements InterfaceServiceProvider
{

    /**
     * 注册一个服务提供者， UserServiceProvider
     * @param  Container $container 传入容器
     * @throws \DInvalidArgumentException
     * @return mixed|void [type]
     */
    public function register(Container $container)
    {
        $closure = function($options=[])
        {
            if (!is_array($options)) {
                $options = [];
            }

            return new User($options);
        };

        $container->share('user',$closure) ->alias('app.user')->alias('application.user');
    }

}// end class UserServiceProvider